00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef DE_FILESYSTEM_HPP
00033 #define DE_FILESYSTEM_HPP
00034
00035 #include "deGlobalTypes.hpp"
00036
00037 #if defined(DEFILE_DLL_EXPORTS) || defined(DESTINY3D_EXPORT_ALL)
00038 # define DEFILESYSTEM_API extern "C" DEDLL_EXPORT
00039 #elif defined(DESTINY3D_STATIC_LINK)
00040 # define DEFILESYSTEM_API extern "C"
00041 #else
00042 # define DEFILESYSTEM_API extern "C" DEDLL_IMPORT
00043 #endif
00044
00045 #ifdef USING_DESTINY3D
00046 #ifdef _DEBUG
00047 # ifdef DESTINY3D_STATIC_LINK
00048 # pragma comment(lib, "deFile_sd")
00049 # else
00050 # pragma comment(lib, "deFiled")
00051 # endif //DESTINY3D_STATIC_LINK
00052 #else
00053 # ifdef DESTINY3D_STATIC_LINK
00054 # pragma comment(lib, "deFile_s")
00055 # else
00056 # pragma comment(lib, "deFile")
00057 # endif //DESTINY3D_STATIC_LINK
00058 #endif //_DEBUG
00059 #endif //USING_DESTINY3D
00060
00061
00062
00063
00064
00065 class IdeFileSystem;
00066 class IdeFSReal;
00067 class IdeFSVirtual;
00068 class IdeFile;
00069 struct deFileProperties;
00070
00071 class IdeFile;
00072 struct deFileProperties;
00073
00074
00075
00076
00077 extern "C"
00078 {
00079
00080 DEFILESYSTEM_API IdeFSReal* IdeFileSystem_CreateFSReal();
00081
00082 DEFILESYSTEM_API IdeFSVirtual* IdeFileSystem_CreateFSVirtual();
00083 }
00084
00085
00086
00087
00088
00089
00090 #pragma warning (disable : 4250)
00091
00092
00093 typedef DWORD (*deFSPROGRESS)(s64 BytesCopied, s64 FileSize, DWORD FileStatus, const char *SourceFile, const char *DestinationFile);
00094
00095
00096 #define deFSPROGRESS_CONTINUE 0x00000001 //continue the operation in question
00097
00098 #define deFSPROGRESS_CANCEL 0x00000002 //cancel the operation that is happening. If a file is moved, it is erased
00099
00100
00101 #define deFSPROGRESS_CANCELCURRENT 0x00000004 //cancel just the current file operation, continue on to the next file. Valid
00102
00103
00104 #define deFSPROGRESS_QUIET 0x00000010 //stop sending messages
00105
00106
00107 #define deFSCALLBACK_FINISHED 0x00000001 //finished the operation on the specified file
00108
00109 #define deFSCALLBACK_ERROREXISTS 0x00000002 //error occurred due to an existing file or directory. Continue operation or Cancel?
00110
00111
00112 #define deFSCALLBACK_ERROROPENED 0x00000003 //error occurred due to the specified file currently being opened. Continue operation?
00113
00114
00115 #define deFSCALLBACK_ERRORFATAL 0x00000004 //a fatal error during the operation (probably memory related). The operation WILL be
00116
00117
00118 #define deFSCALLBACK_STARTING 0x00000005 //returned each time a new file has an operation started on it
00119
00120 #define deFSCALLBACK_BLOCKMOVED 0x00000006 //a block of data was moved. If Cancel is returned, the resulting file is removed.
00121
00122
00123 #define deFSCALLBACK_RECURSE 0x00000007 //should the sub directory be recursed into during a copy? Cancel stops
00124
00125
00126
00127 #define deFSCALLBACK_VFSLARGEMOVE 0x00010000 //a file is done moving. the VFS is being shifted to cover the file's original spot
00128
00129
00130
00131
00132
00133
00134
00135 typedef void* deFSFindHandle;
00136
00137
00138
00139
00140
00141
00142
00143 DE3D_INTERFACE(IdeFileSystem, IdeRefCountBase)
00144 {
00145 public:
00146
00147 protected:
00148 virtual ~IdeFileSystem() {}
00149 public:
00150
00151 enum interface_t
00152 {
00153 iface_IdeFileSystem = 0,
00154 iface_IdeFSReal,
00155 iface_IdeFSMemory,
00156 iface_IdeFSVirtual,
00157 iface_force_32bit = 0x7FFFFFFF
00158 };
00159
00160
00161
00162 virtual void* GetInterface(IdeFileSystem::interface_t i) = 0;
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 virtual IdeFile* Open(const char *Filename, long OpenFlags) = 0;
00173
00174
00175 virtual const char *GetDirectory() = 0;
00176
00177 virtual deBoolean SetDirectory(const char *Directory) = 0;
00178
00179
00180
00181
00182
00183 virtual deBoolean Rename(const char *OldFilename, const char *NewFilename) = 0;
00184
00185
00186
00187
00188
00189 virtual deBoolean Delete(const char *Filename, deFSPROGRESS StatusCallback) = 0;
00190
00191
00192
00193
00194
00195 virtual deBoolean Move(const char *OldFilename, const char *NewFilename, deFSPROGRESS StatusCallback) = 0;
00196
00197
00198
00199
00200
00201 virtual deBoolean Copy(const char *OldFilename, const char *NewFilename, deFSPROGRESS StatusCallback) = 0;
00202
00203
00204
00205 virtual deBoolean AddDirectory(const char *Directory) = 0;
00206
00207
00208
00209
00210
00211 virtual deBoolean DeleteDirectory(const char *Directory, deFSPROGRESS StatusCallback) = 0;
00212
00213
00214
00215
00216
00217 virtual void* FindFirst(const char *Pattern, deFileProperties *Properties) = 0;
00218
00219
00220
00221
00222
00223 virtual deBoolean FindNext(void* Handle, deFileProperties *Properties) = 0;
00224
00225
00226
00227
00228 virtual deBoolean FindEnd(void* Handle) = 0;
00229
00230 };
00231
00232
00233
00234
00235
00236 DE3D_INTERFACE(IdeFSReal, IdeFileSystem)
00237 {
00238 protected:
00239 ~IdeFSReal() {}
00240 };
00241
00242
00243
00244
00245
00246 DE3D_INTERFACE(IdeFSVirtual, IdeFileSystem)
00247 {
00248 protected:
00249 ~IdeFSVirtual() {}
00250
00251 public:
00252
00253
00254 virtual deBoolean OpenBaseFile(IdeFile *BaseFile, long OpenFlags) = 0;
00255 virtual deBoolean OpenBaseFilename(const char *Filename, long OpenFlags) = 0;
00256 virtual deBoolean CloseBaseFile() = 0;
00257 };
00258
00259
00260
00261 #endif